package com.itheima;

public class Demo4 {
    public static void main(String[] args) {
        int fac = factorial(3);
        System.out.println(fac);
    }

    public static int factorial(int n) {
        if (n == 1) {
            return 1;
        }else {
            return n * factorial(n - 1);
        }
    }
}
